package com.nineclock.system.feign;

import com.nineclock.common.entity.Result;
import com.nineclock.system.dto.SysCompanyUserDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("sys-service")
public interface SysCompanyUserFeign {

    /**
     * 根据用户id、公司id查询员工列表
     * @param userId
     * @param companyId
     * @return
     */
    @GetMapping("companyUser/query")
    public Result<List<SysCompanyUserDTO>> queryCompanyUser(@RequestParam Long userId,
                                                            @RequestParam(required = false) Long companyId);

    /**
     * 根据员工id查询员工信息
     */
    @GetMapping("companyUser/query/{companyUserId}")
    public Result<SysCompanyUserDTO> queryCompanyUserById(@PathVariable Long companyUserId);

    /**
     * 查询当前企业所有员工
     * @return
     */
    @ApiOperation(value = "查询当前企业所有的员工")
    @GetMapping("companyUser/queryAllUser")
    public Result<List<SysCompanyUserDTO>> queryAllCompanyUser();

    /**
     * 查询当前企业所有部门ID集合
     * @return
     */
    @GetMapping("organization/department/top")
    public Result<List<Long>> queryDepartmentIds();

    /**
     * 根据部门ID集合查询部门下的员工数量
     * @param departmentIds
     * @return
     */
    @GetMapping("organization/department/membernum")
    public Result<Integer> queryUserCountByDepartmentIds(@RequestParam List<Long> departmentIds);

    /**
     * 根据员工id获得从低到高级别的部门ID集合
     * @param
     * @return
     */
    @GetMapping("organization/allDepId/{companyUserId}")
    public Result<List<Long>> queryDepartmentsByUserId(@PathVariable Long companyUserId);

    /**
     * 根据企业id获取企业的员工列表
     */
    @GetMapping("companyUser/queryAllUserByCompanyId")
    public Result<List<SysCompanyUserDTO>> queryAllUserByCompanyId(@RequestParam Long companyId);

    /**
     * 根据企业ID查询企业的主管理员
     * @param companyId
     * @return
     */
    @GetMapping("companyUser/queryAdminByCompanyId")
    public Result<SysCompanyUserDTO> queryAdminByCompanyId(@RequestParam Long companyId);

    /**
     * 根据关键字(姓名、工号、部门)查询企业相关人员ids
     */
    @GetMapping("/companyUser/queryByKeyword")
    public Result<List<Long>> queryByKeyword(@RequestParam String keyword);


}

